ZIPFILES=bin model texture sound xml jeux.bat jeux

IRRLICHT=../irrlicht-1.4.1
IRRKLANG=../irrKlang-1.1.0

all: directory linux win32

dist: clean
	@rm -f *~ */*~ */*/~* demo.zip
	zip -r demo $(ZIPFILES)

directory:
	@mkdir -p bin object/ object/linux object/win32

clean:
	@rm -f -r object

realclean: clean
	@rm -f -r bin

#LINUX

LCPP = g++

LREPINCLUDE = -I$(IRRLICHT)/include -I$(IRRKLANG)/include -I/usr/X11R6/include -Iinclude
LCPPFLAGS = -g -Wall $(LREPINCLUDE) -DLINUX

LOBJECTS = object/linux/main.o object/linux/coeur.o object/linux/interface.o object/linux/console.o object/linux/inventaire.o object/linux/item.o object/linux/staticMesh.o object/linux/actionMesh.o object/linux/lieu.o object/linux/chap.o object/linux/local.o object/linux/base.o object/linux/logger.o
WCPP = i586-mingw32msvc-g++

LREPLIB = -L/usr/X11R6/lib -L$(IRRLICHT)/lib/Linux
LLIB = -lIrrlicht -lGL -lGLU -lXxf86vm -lXext -lX11 -lpthread
LLDFLAGS =  $(LREPLIB) $(LLIB)

LOUT=bin/jeux

linux : $(LOUT)

$(LOUT): $(LOBJECTS)
	$(LCPP) $(LOBJECTS) -o $(LOUT) $(LLDFLAGS) $(IRRKLANG)/bin/linux-gcc/libIrrKlang.so

object/linux/%.o: sources/%.cpp
	$(LCPP) $(LCPPFLAGS) -c -o $@ $<



#win32

WREPINCLUDE = -I$(IRRLICHT)/include -I$(IRRKLANG)/include -I/usr/X11R6/include -Iinclude -Iwin32/include
WCPPFLAGS = -g -Wall $(WREPINCLUDE) -DWIN32

WOBJECTS = object/win32/main.o object/win32/coeur.o object/win32/interface.o object/win32/console.o object/win32/inventaire.o object/win32/item.o object/win32/staticMesh.o object/win32/actionMesh.o object/win32/lieu.o object/win32/chap.o object/win32/local.o object/win32/base.o object/win32/logger.o

WREPLIB = -L$(IRRLICHT)/lib/Win32-gcc -Lwin32/lib -L$(IRRKLANG)/lib/Win32-gcc
WLIB = -lIrrlicht -lopengl32 -lglu32 -lirrKlang
WLDFLAGS =  $(WREPLIB) $(WLIB)

WOUT=bin/jeux.exe

win32 : $(WOUT)

$(WOUT): $(WOBJECTS)
	cp $(IRRLICHT)/bin/Win32-gcc/Irrlicht.dll bin/
	cp $(IRRKLANG)/bin/win32-gcc/irrKlang.dll bin/
	$(WCPP) -o $(WOUT) $(WLDFLAGS) $(WCPPFLAGS) $(WOBJECTS) bin/Irrlicht.dll bin/irrKlang.dll

object/win32/%.o: sources/%.cpp
	$(WCPP) $(WCPPFLAGS) -c -o $@ $<

